package com.ruoyi.caipiao.utils;

import lombok.extern.slf4j.Slf4j;

import java.io.File;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

/**
 * @author wangcen
 * @date 2025/1/3 21:44
 */
@Slf4j
public class Pl3Test6 {

    public static void main(String[] args) {
//        String today = DateUtil.format(new Date(), "yyyy-MM-dd");
        String today ="202501070952";
        cal(today);
    }

    public static void cal(String today) {
        log.info("计算开始");

//        String today = DateUtil.format(new Date(), "yyyy-MM-dd");
        String dir = "D:\\pl3\\" + today;
        Set<String> set = new TreeSet<>();
        File file = new File(dir);
        File[] files = file.listFiles();
        int cc = 0;
        for (File file1 : files) {
            if(file1.getName().contains("0000")) {
                continue;
            }
            List<String> strings = MyFileUtil.readFileAsList(file1);
            for (String str : strings) {
                String[] split = str.split(",");
                int ct = Integer.parseInt(split[1]);
                if(ct <= 2) {
                    set.add(split[0]);
                }
            }
            cc++;
            if(set.size() > 900) {
                System.out.println("是否中将:"+(set.contains("656"))+"，文件个数："+cc+", 号码大小:"+set.size());
                set.clear();
                cc = 0;
            }

        }
        log.info("排除号码("+set.size()+"):"+set.toString());
        MyFileUtil.writeContentToFile(dir + File.separator + "0000000_max_count_nums.txt", "排除号码("+set.size()+"):"+set.toString(), true);
        log.info("计算完成");

    }
}
